<ul class="navbar-nav">
    <li class="nav-item">
      <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
    </li>
    <li class="nav-item d-none d-sm-inline-block" >
      <a data-url="member/index" class="nav-link" id="homepage">主页</a>
    </li>
    
</ul>
<ul class="navbar-nav ml-auto">
  <li class="nav-item d-none d-sm-inline-block">
    <a href="javascript:void(0);" class="nav-link" id="logOut">退出登录</a>
  </li>
</ul>
<script>
 function getContextPath() {
        var curWwwPath = document.location.href;
        var pathName = document.location.pathname;     
        var pos = curWwwPath.indexOf(pathName);
        var localhostPath = curWwwPath.substring(0,pos);
        return localhostPath;
        // return "C:\\Users\\zhuoQiang\\Desktop\\web\\proj"
    }
  $("#homepage").attr("href",getContextPath() + "\/"+  $("#homepage").data("url"))
  // $("#logOut").attr("href",getContextPath() + "\/"+  $("#logOut").data("url"))
  $("#logOut").on("click", function () {
    $.ajax(
      {
        type: 'GET',
        url: "/member/quit",
        async: true,
        dataType: 'Text',
        crossDomain: true,
        xhrFields: {
          withCredentials: true
        },
        success: function (res) {
          console.log("success"+res)
          window.location.href = "/member/login"
          return false
        },
        error: function (err) {
          console.log("fail"+err)
          return false
        }
      })
  })
</script>